# for 循环遍历
magicians = ["alice","david","carolina"]
for magician in magicians:
    print(magician)
    print(f"{magician.title()}, that was a great trick!\n")
print("Thank you, everyone. That was a great magic show!")


# 创建数值列表 range()
for value in range(1,5):
    print(value)
for value in range(6):
    print(value)

## 使用 range()创建数值列表
numbers = list(range(1,6))
print(numbers)

## 设置步长
even_number = list(range(2,11,2))
print(even_number)

squares = []
for value in range(1,10):
    print("1: ")
    print(value)
    value = value ** 2
    print("2: ")
    print(value)
    squares.append(value)
print(squares)

# 对数值列表进行简单统计计算
digits = [1,2,3,4,5,6,7,8,9,0]
print(min(digits))
print(max(digits))
print(sum(digits))

# 列表推导式
squares = [value **2 for value in range(1,11)]
print(squares)


# 使用列表的一部分  切片
players = ["charles","martina","michael","florence","eli"]
print(players)
print(players[1:4])
print(players[:4])
print(players[2:])
print(players[-3:])
for player in players[:3]:
    print(player)


# 复制列表
my_foods = ["pizza","falafel","carrot cake"]
friend_foods = my_foods[:]  # 切片算浅拷贝
friend_foods2 = my_foods # 复制指针
print(my_foods)
print(friend_foods)
print(friend_foods2)
my_foods[0] = 'apple'
print(my_foods)
print(friend_foods)
print(friend_foods2)
a = 2
b = a
print(b)
a = 3
print(b)
